home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-03-02 | 2.1 KB | 50 lines | [TEXT/GEOL] |
- Item 0857294 1-March-90 09:04
-
- From: DASNET# DASNET, Anna Lange,VCA
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: Re: Cloning in MacAp
-
- TO ANSWER, set "Send to" to: Ravinder.Chandhok@GNOME.CS.CMU.EDU@DASNET#
-
-
- > Martin Carlberg <d6maca@dtek.chalmers.se> writes:
-
- >MacApp has Clone and ShallowClone, but the funny is that Clone is never
- >implemented in any classes except in TObject. If I want to do a shallow clone
- >I can call Clone or ShallowClone. If I want a deep clone I have to implement
- >my own Clone method even for MacApp's classes and I think THAT is wrong. Look
- >at the Free method, it will free objects/data recursively. If I just want to
- >free the object I can call ShallowFree. It's not working the same way!?!.
- >I think people are wrong when they say that the Clone method should not be
- >implemented so objects and data are freed recursively. There are two clone
- >methods (Clone and ShallowClone) and let us use both of them.
-
- Recent discussion on Macoops has centered on the problems of using "Clone"
- in MacApp and Copy in TCL. One of the fundamental misunderstandings here is
- that there is a difference between "cloning" and "copying". I don't think
- they are the same. Both MacApp and TCL mix the meanings up.
-
- For example, if I clone an object, I may want to keep shared references
- around, so "free" gets more difficult. If I "copy" an object, then "free"
- should recursively free things for me.
-
- So, should there be "freecopy" and "freeclone"? And should the Object.Free
- say "IF Self.fWasClone THEN FreeClone ELSE FreeCopy" ?
-
- I use cloning to refer to another way of instantiating new objects from a
- dynamic template, like building a TRectangle object from a canonical
- TRectangle object that is in a palette (as in several MacApp example
- programs). I use copying when I need an independant copy of an object (to
- put in the clipboard, for example).
-
- So perhaps when an object is created, via NEW or whatever, it should
- remember if it was CLONED, COPIED, or NEWED. I think the NEWed state is
- equal to the COPIED state. [of course, it would be more fun to have "nude"
- objects]
-
- Rob
-
-
-